Skip to content

Add X11 paste support and native Anthropic API post-processing#266

Open
nascent-chris wants to merge 1 commit intopeteonrails:mainfrom
nascent-chris:feat/x11-paste-and-anthropic-postprocess
Open

Add X11 paste support and native Anthropic API post-processing#266
nascent-chris wants to merge 1 commit intopeteonrails:mainfrom
nascent-chris:feat/x11-paste-and-anthropic-postprocess

Conversation

@nascent-chris
Copy link
Copy Markdown

Summary

  • X11 paste mode: Adds xclip and xdotool as fallbacks in paste mode, which was previously Wayland-only (required wl-copy + wtype). Enables --paste on X11 desktops with the chain: xclip (clipboard) + xdotool (keystroke). Also adds xdotool fallback to send_enter() for auto-submit.
  • Native Anthropic API post-processing: Adds a built-in Anthropic API client as an alternative to shelling out to an external command for post-processing. Transcriptions can be sent directly to a Claude model (e.g., Haiku) for cleanup -- fixing transcription errors, removing filler words, improving conciseness.
  • Backwards compatible: All new config fields use #[serde(default)] and Option<String>. Existing configs parse without changes.

Configuration

[output.post_process]
anthropic_model = "claude-haiku-4-5-20251001"
anthropic_api_key_file = "/path/to/.env"   # or set ANTHROPIC_API_KEY env var
# anthropic_prompt = "Custom cleanup instructions..."
timeout_ms = 10000

API key resolution order: explicit config value > ANTHROPIC_API_KEY env var > specified file > ~/.config/voxtype/.env > ~/.env > ./.env

Falls back to original transcription text on any failure (timeout, API error, empty response).

Test plan

  • Tested paste mode on X11 with xclip + xdotool (Ctrl+Shift+V into terminal)
  • Tested Anthropic post-processing with Haiku (observed ~1s cleanup latency)
  • Verified all 519 unit tests pass
  • Verified backward compatibility with existing configs (no anthropic fields)
  • Verified graceful fallback when API key is missing or API call fails

🤖 Generated with Claude Code

Two features:

1. X11 paste mode support: The paste output mode was Wayland-only
   (required wl-copy). This adds xclip as a clipboard fallback and
   xdotool as a keystroke simulator fallback, enabling paste mode on
   X11 desktops. Also adds xdotool fallback to send_enter() for
   auto-submit on X11.

2. Native Anthropic API post-processing: Instead of shelling out to
   an external command, transcriptions can now be sent directly to
   a Claude model (e.g., Haiku) for cleanup. Configured via:

     [output.post_process]
     anthropic_model = "claude-haiku-4-5-20251001"
     anthropic_api_key_file = "/path/to/.env"
     timeout_ms = 10000

   API key resolution: explicit config > ANTHROPIC_API_KEY env var >
   specified file > ~/.config/voxtype/.env > ~/.env > ./.env

   Falls back to original text on any failure (timeout, API error,
   empty response). Uses ureq with proper HTTP-level timeouts via
   spawn_blocking to avoid blocking the async runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nascent-chris
Copy link
Copy Markdown
Author

Claude got a little excited about creating this PR -- feel free to close if you like -- but I'm using this and it's handy!

@nascent-chris nascent-chris force-pushed the feat/x11-paste-and-anthropic-postprocess branch from 10d7aa1 to a4ae9c4 Compare March 17, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant